package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
  /**
   * 新增
   */
  void batchInsert(List<SetmealDish> setmealDishes);
  
  /**
   * 根据菜品id查询套餐
   * @return
   */
  @Select("select * from setmeal_dish where dish_id = #{id}")
  SetmealDish findByDishId(Long id);
  
  /**
   * 根据套餐id查询套餐
   * @param id
   */
  @Select("select * from setmeal_dish where setmeal_id = #{id}")
  List<SetmealDish> findBySetmealId(Long id);
  
  
  /**
   * 根据菜品id查询对应的套餐id
   * @return
   */
  // select setmeal_id from setmeal_dish where dish_id in (1,2,3,4)
  List<Long> getSetmealIdsByDishIds(List<Long> dishIds);
  
  /**
   * 根据套餐id获取对应菜品id
   * @param setmealIds
   */
  List<Long> getDishIdsBySetmealIds(List<Long> setmealIds);
  
  /**
   * 批量删除套餐
   * @param ids
   */
  void batchDelete(List<Long> ids);

}
